package com.selftaught.login.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.selftaught.login.model.dto.user.UserLoginRequest;
import com.selftaught.login.model.dto.user.UserRegisterRequest;
import com.selftaught.login.model.entity.User;
import com.selftaught.login.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 用户服务
 *
 * @author <a href="https://gitee.com/wanghuya">程序员虎牙</a>
 * @date 2024-09-26
 */
public interface UserService extends IService<User> {

    /**
     * 注册
     *
     * @param userRegisterRequest userRegisterRequest
     * @return 结果
     */
    long register(UserRegisterRequest userRegisterRequest);

    /**
     * 登录
     *
     * @param userLoginRequest userLoginRequest
     * @param request          request
     * @return 结果
     */
    User login(UserLoginRequest userLoginRequest, HttpServletRequest request);

    /**
     * 退出登录
     *
     * @param request request
     * @return 结果
     */
    boolean logout(HttpServletRequest request);

    /**
     * 获取当前登录用户
     *
     * @param request request
     * @return 结果
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 获取脱敏的用户信息
     *
     * @param user user
     * @return 结果
     */
    UserVO getUserVo(User user);
}
